package com.example.springboottest.example.aspectj;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Aspect
@Service
public class AspectJTest {
    private Logger log = LoggerFactory.getLogger("com.example.springboottest.example.aspectj");

    @Around("execution (* com.example.springboottest..*Service.*(..))")
    public void arroundTest(ProceedingJoinPoint joinPoint) {
        Signature signature = joinPoint.getSignature();
        try {
            System.out.println("进入前....");
            joinPoint.proceed();
            System.out.println("进入后....");
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
    }
}
